package com.zhangyu.shadow.event;

import android.os.Build;
import android.support.annotation.RequiresApi;
import android.webkit.WebView;

import com.zhangyu.shadow.core.delegate.web.event.Event;
import com.zhangyu.shadow.core.util.toast.ToastUtils;

/**
 * @author zhangyu
 * @date 2017/11/13
 */

public class TestEvent extends Event {
    @Override
    public String execute(String params) {
        ToastUtils.showToast(getContext(),params);
        if(getAction().equals("test")){
            final WebView webView = getWebView();
            webView.post(new Runnable() {
                @RequiresApi(api = Build.VERSION_CODES.KITKAT)
                @Override
                public void run() {
                    webView.evaluateJavascript("nativeCall() ",null);
                }
            });
        }
        return null;
    }
}
